# -*- coding: utf-8 -*-
"""
author:码同学 极光
date:2025/3/8
desc: 
sample: 
"""
import requests
import json
import re

from faker import Faker

faker = Faker('zh_CN')
def soap_xml(phone):
    xml_header = {'Content-type': 'text/xml'}
    with open('xml.txt',encoding='utf-8') as f:
        data=f.read()
    data= data.format(phone,'')
    print(data)
    reps= requests.post(url='http://ws.webxml.com.cn/WebServices/MobileCodeWS.asmx?op=getMobileCodeInfo',
                  headers=xml_header,data=data)
    print(reps.text)
    reg = r'<getMobileCodeInfoResult>(.+)</getMobileCodeInfoResult>'
    result = re.findall(reg, reps.text)
    print(result)


if __name__ == '__main__':
    soap_xml(faker.phone_number())